FROM alpine:3.7

LABEL maintainer="Roy Kim <roy.kim@navercorp.com>"

ARG PINPOINT_VERSION=${PINPOINT_VERSION:-2.2.0}

RUN apk add --no-cache bash

COPY /build/scripts/configure-agent.sh /usr/local/bin/
COPY /pinpoint-agent-${PINPOINT_VERSION}.tar.gz pinpoint-agent.tar.gz

RUN chmod a+x /usr/local/bin/configure-agent.sh \
    && mkdir -p /pinpoint-agent \
    && chmod -R o+x /pinpoint-agent \
    && gunzip pinpoint-agent.tar.gz \
    && tar -xf pinpoint-agent.tar --strip 1 -C /pinpoint-agent \
    && rm pinpoint-agent.tar

#COPY /pinpoint-webrts-plugin-2.2.0-SNAPSHOT.jar /pinpoint-agent/plugin/

VOLUME ["/pinpoint-agent"]

ENTRYPOINT ["/usr/local/bin/configure-agent.sh"]
CMD ["tail", "-f", "/dev/null"]